package com.itcast.hotel.web;

import com.itcast.hotel.pojo.PageResult;
import com.itcast.hotel.pojo.RequestParams;
import com.itcast.hotel.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 29143
 */
@RestController
@RequestMapping("/hotel")
public class HotelWeb {

    @Autowired
    private HotelService hotelService;

    @PostMapping ("/list")
    public PageResult list(@RequestBody RequestParams params){
        return hotelService.search(params);
    }

    @PostMapping("/filters")
    public Map<String, List<String>> filters(RequestParams params){
        return hotelService.getFilters(params);
    }

    @GetMapping("/suggestion")
    public List<String> getSuggestions(String key){
        return hotelService.getSuggestions(key);

    }
}
